home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr10
/
v12n12.zip
/
PCMCVT.ZIP
/
PCMASM.ZIP
/
W4DCONV.INC
< prev
next >
Wrap
Text File
|
1993-05-22
|
3KB
|
114 lines
;W4DCONV.INC
;Copyright (c) 1993 Jay Munro
;First Published in PC Magazine June 29 1993
;PCMCVT Conversion module for Word 5.0 & 5.5
;
;Each module is responsible for reading and writing text via the system
;buffers. Command line flags are global and available.
;
Word4DOSCVT Proc Near
Invoke Seek, SHandle, 128 ;seek to start of file
Jnc @F
Jmp W4DExit ;error, bag out
@@:
Lea SI, HeaderBuffer ;get address of header to check
Mov Word Ptr AX, [SI].MSWdfcMac ;get low word of end of text
Mov MSW4DFileEnd,AX
Mov Word Ptr AX,[SI+2].MSWdfcMac ;and high byte
Mov MSW4DFileEnd[2],AX
Sub Word Ptr MSW4DFileEnd,128 ;clear off starting point
Sbb Word Ptr MSW4DFileEnd[2],0
ReadW4DFile:
Call W4DReadIt ;go read the file
RW4DLoop: ;weed out control chars
LodSb ;grab a character
Sub Word Ptr MSW4DFileEnd, 1
Sbb Word Ptr MSW4DFileEnd[2], 0
Cmp Word Ptr MSW4DFileEnd, 0
Jnz @F
Cmp Word Ptr MSW4DFileEnd[2], 0
Jnz @F
Call FlushIt
Jmp W4DExit ;exit stage left
MSW4DFileEnd DW 0,0
@@:
Cmp AL,13 ;a carriage return?
Jnz @F
Call W4DWrite
Jmp W4DReLoop ;skip over
@@:
Cmp AL,10 ;hard cr for W4D
Jnz @F
Call W4DWrite ;write what's in AL
Jmp W4DReLoop
@@:
Cmp AL,11
Jnz @F
Mov AL,13
Call WriteIt ;write what's in AL
Mov AL,10 ;make it a hard return
Call WriteIt
Jmp W4DReLoop
@@:
Cmp AL,15 ;em dash?
Jnz @F ;nope, keep going
Mov AL,'-' ;store duel hyphans
Call W4DWrite
Mov AL,'-' ;store duel hyphans
Call W4DWrite
Jmp W4DReLoop
@@:
Cmp AL,2 ;print current date;
Jnz @F ;future expansion
@@:
Cmp AL,3 ;print current time
Jnz @F ;future expansion
@@:
Cmp AL,9 ;tab
Jnz @F
Call DoTabs ;expand the tabs
Jmp W4DReLoop
@@:
Cmp AL,31 ;ok, skip the rest
Jbe W4DReLoop ;skip it
Cmp AL,196 ;two other skippers
Jz W4DReLoop
Cmp AL,255
Jz W4DReLoop
;write what's left
Call W4DWrite ;call our local write module
Jmp W4DReLoop
W4DReLoop:
Loop RW4DLoop
Jmp ReadW4DFile ;go back for more
W4DWrite:
Call WriteIt ;no, then write it
Jc W4DExit
RetN
W4DReadIt:
Call ReadIt ;go read the file
Jnc @F ;a fine read, continue
Mov AL,-1 ;a bad read, quit now
Call W4DWrite ;flush buffer
Jmp W4DExit
@@:
RetN
W4DExit:
Ret
Word4DOSCVT EndP